<?php 

/**
 * Singular Content Template
 */

?>

<?php get_header(); ?>

<div class="main wrap cf">
	<div class="row">
		<div class="col-6 main-content" style="padding-right: 10px;border-right: 1px #DDD solid;">
		
			<?php while (have_posts()) : the_post(); ?>
				
				<?php 
					
					$panels = get_post_meta(get_the_ID(), 'panels_data', true);
					
					if (!empty($panels) && !empty($panels['grid'])):
						
						get_template_part('content', 'builder');
					
					else:
					
						get_template_part('content', 'single');
						
					endif; 
				?>
                
				<div class="comments">
				<?php //comments_template('', true); ?>
				</div>
	
			<?php endwhile; // end of the loop. ?>
			<ul style="padding-left: 15px;">
			<?php
                query_posts(array(
                    'showposts' => 5,
                    'orderby' => 'rand',
                    'category_in' => array(1,7,5,3,6,4)
                ));
             if (have_posts()) : while (have_posts()) : the_post(); 
			 	$view_count = bawpvc_views_sc(post_view);
				$view_count = str_replace('(', '', $view_count);
				$view_count = str_replace(')', '', $view_count);
				$view_count = "<span> <i class = 'fa fa-bell'></i> ".$view_count." </span>";
            ?>
                <li style="list-style:square; margin-bottom: 3px;">
                    <a href="<?php the_permalink(); ?>">
                    	<?php echo the_title(); ?>
                    	<span style="margin-left: 10px; color: #9f224e; font-size: 12px; font-weight: bold;"><?php echo $view_count; ?></span>
                    </a>
                 	<br>
                </li>
                
            <?php endwhile; // end of the loop. ?>
            <?php endif;?>
            </ul>    
		</div>
		<div class="col-2 ads-custom" style="padding: 0 10px;">
			<h3 style=" background-color:#E7E7E7; font-size: 14px; text-align: center; color:#9f224e; padding: 4px 0; margin-bottom: 10px; border-top: 2px #9f224e solid; font-weight: bold;">Tin tức nổi bật</h3>
			<?php
				query_posts(array(
					'showposts' => 5,
					'orderby' => 'rand',
					'category_in' => array(1,7,5,3,6,4)
				));
			 if (have_posts()) : while (have_posts()) : the_post(); 
			
				$view_count = bawpvc_views_sc(post_view);
				$view_count = str_replace('(', '', $view_count);
				$view_count = str_replace(')', '', $view_count);
				$view_count = "<span> <i class = 'fa fa-comments' style='font-size: 14px;'></i> ".$view_count." </span>";
			?>
				<div class="post-rand-item">
					<?php echo get_the_post_thumbnail( $page->ID, 'thumbnail' ); ?>
					<a href="<?php the_permalink(); ?>">
						<?php echo the_title(); ?>
						<span style="margin-left: 10px; color: #9f224e; font-size: 12px; font-weight: bold;"><?php echo $view_count; ?></span>
					</a><br>
				</div>
				
			<?php endwhile; // end of the loop. ?>
			<?php endif;?>
			<style>
				.ads-custom .post-rand-item{
					margin-bottom: 20px;
					width: 100%;
				}
				.ads-custom .post-rand-item img{
					width: 100%;
					height: 100px;
				}
			</style>
		</div>
		<?php Bunyad::core()->theme_sidebar(); ?>
		
	</div> <!-- .row -->
</div> <!-- .main -->

<?php get_footer(); ?>